from urllib import request

req = request.Request("http://www.douban.com")
req.add_header("Accept", 
	"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
req.add_header("User-Agent", 
	"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36")

req.add_header("Accept-Encoding","gzip, deflate, sdch, br")
with request.urlopen(req) as f:
	print("status >>> ", f.status, f.reason)
	print("*** headers *****")
	for k,v in f.getheaders():
		print("%s: %s" % (k,v))
	print("*****************")

	print("data: ", f.read().decode("utf-8"))
